#include "unp.h"

int main(int argc , char *argv[])
{
   mqd_t mqd;
   struct mq_attr attr;
   int ret;
   if(argc < 2 )
      err_quit("Usage: mq_attr <name>");

   mqd = mq_open(argv[1],O_RDONLY);
   if(mqd == -1)
      err_sys("mq_open error!");
   ret = mq_getattr(mqd,&attr);
   if( ret == -1)
      err_sys("mq_getattr error!");

   printf("mqd(%d) mq_flags:%ld mq_maxmsg:%ld mq_msgsize:%ld mq_curmsgs:%ld\n",
          mqd,attr.mq_flags,attr.mq_maxmsg,attr.mq_msgsize,attr.mq_curmsgs);

   mq_close(mqd);
   return 0;
}
